/*
 * Created by JFormDesigner on Mon May 05 16:32:13 CST 2025
 */

package com.soft.bams.client;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

/**
 * @author 21603
 */
public class MainPanel extends JPanel {

    public MainPanel() {
        initComponents();
    }

    private void register(ActionEvent e) {
        CardLayout cardLayout  = (CardLayout) this.getParent().getLayout();
        cardLayout.show(this.getParent(),"register");
    }

    private void login(ActionEvent e) {
        CardLayout cardLayout  = (CardLayout) this.getParent().getLayout();
        cardLayout.show(this.getParent(),"login");
    }

    private void initComponents() {
        // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents  @formatter:off
        titleLabel = new JLabel();
        registerButton = new JButton();
        loginButton = new JButton();

        //======== this ========
        setLayout(null);

        //---- titleLabel ----
        titleLabel.setText("BAMS ATM \u7ec8\u7aef");
        titleLabel.setFont(new Font("Microsoft YaHei UI", Font.BOLD, 16));
        add(titleLabel);
        titleLabel.setBounds(125, 50, 140, 30);

        //---- registerButton ----
        registerButton.setText("\u5f00\u6237");
        registerButton.addActionListener(e -> register(e));
        add(registerButton);
        registerButton.setBounds(new Rectangle(new Point(95, 175), registerButton.getPreferredSize()));

        //---- loginButton ----
        loginButton.setText("\u767b\u5f55");
        loginButton.addActionListener(e -> login(e));
        add(loginButton);
        loginButton.setBounds(new Rectangle(new Point(215, 175), loginButton.getPreferredSize()));

        setPreferredSize(new Dimension(400, 300));
        // JFormDesigner - End of component initialization  //GEN-END:initComponents  @formatter:on
    }

    // JFormDesigner - Variables declaration - DO NOT MODIFY  //GEN-BEGIN:variables  @formatter:off
    private JLabel titleLabel;
    private JButton registerButton;
    private JButton loginButton;
    // JFormDesigner - End of variables declaration  //GEN-END:variables  @formatter:on
}
